

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.sql.*;


	public class Loginid {
		public static void main(String[] args)
		{
			BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
			try 
			{ 
				System.out.println("Enter your Username");
				String usr=br.readLine();
				System.out.println("Enter your password");
				String pass=br.readLine();
				
				Class.forName("oracle.jdbc.driver.OracleDriver");
				Connection con = DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:orcl","scott","tiger");
				Statement st=con.createStatement();
			    
				PreparedStatement pst=con.prepareStatement("insert into loginid values(?,?)");
				
				pst.setString(1, usr);
				
				
				pst.setString(2, pass);
				
				pst.execute();
				
				System.out.println("Records inserted successfully");
				 
	 
				/*
			     ResultSet rs=st.executeQuery("Select * from emp");    
			    int flag=0; 
			   while(rs.next())
			   {
			      //rs.next();
			     //System.out.println(rs.getInt(1)+"\t\t"+rs.getString(2)+"\t\t"+rs.getDouble(6));
			      String tusr=rs.getString(1); String tpass=rs.getString(2); 
			      System.out.println("Username "+tusr+" pass "+tpass);
			      if(tusr.equals(usr) && tpass.equals(pass))
			      {
			    	  flag=1;
			    	  break;
			      }
			      else
			      {
			    	flag=0; 
			      }
			   }
			   if(flag==1)
			     {
			    	  System.out.println("Login Successful");
			     }
			     else
			     {
			    	System.out.println("Invalid login details"); 
			     }*/
			  }     
			
			catch (Exception e) 
			{
				e.printStackTrace();
			} 
			
			
		}

	}



